package com.hs.mobile.service.register;

import java.util.List;

import com.hs.mobile.model.Register;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.hs.mobile.dao.register.RegisterDAO;

@Service("registerService")
public class RegisterServiceImpl implements RegisterService {
	@Autowired
	RegisterDAO registerDAO;
	/**
	 * @name setDeviceDAO
	 * @param deviceDAO
	 */
	public void setRegisterDAO( RegisterDAO registerDAO )
	{
		this.registerDAO = registerDAO;
	}
	
	/**
	 * 
	 * @return deviceDAO
	 */
	public RegisterDAO getRegisterDAO()
	{
		return registerDAO;
	}
	@Override
	public void save(Register register) {
		// TODO Auto-generated method stub
		registerDAO.add(register);
	}

	@Override
	public void update(Register register) {
		// TODO Auto-generated method stub
		registerDAO.update(register);
	}

	@Override
	public void delete(long id) {
		// TODO Auto-generated method stub
		Register register = registerDAO.findByRegisterId(id);
		registerDAO.delete(register);
	}

	@Override
	public Register findRegisterById(long id) {
		// TODO Auto-generated method stub
		Register register = (Register) registerDAO.findByRegisterId(id);
		return register;
	}

	@Override
	public List<Register> getAllRegisters() {
		// TODO Auto-generated method stub
		return registerDAO.getListAll();
	}

	@Override
	public List<Register> getRegistersByDeviceId(long deviceId) {
		// TODO Auto-generated method stub
		return registerDAO.getAllRegisterByDeviceId(deviceId);
	}

	@Override
	public List<Register> getRegistersByDeviceIdandCategoryId(long deviceId,
			long categoryId) {
		// TODO Auto-generated method stub
		return registerDAO.getAllRegisterByDeviceIdandCategoryId(deviceId, categoryId);
	}

}
